import { CoolController, BaseController } from '@cool-midway/core';
import { GoodsPromoOrderService } from '../../service/promo_order.service';
import { Body, Inject, Post } from '@midwayjs/core';

/**
 * 促销订单管理端
 */
@CoolController()
export class AdminGoodsPromoOrderController extends BaseController {
  @Inject()
  goodsPromoOrderService: GoodsPromoOrderService;

  /**
   * 管理员创建套餐订单（测试用）
   */
  @Post('/createComboOrder')
  async createComboOrder(@Body() params: {
    userId: string;
    billNo: string;
    remark?: string;
  }) {
    return this.ok(await this.goodsPromoOrderService.createComboOrder(
      params.userId,
      params.billNo,
      params.remark
    ));
  }

  /**
   * 管理员创建秒杀订单（测试用）
   */
  @Post('/createSeckillOrder')
  async createSeckillOrder(@Body() params: {
    userId: string;
    billNo: string;
    goodsId: string;
    quantity: number;
    remark?: string;
  }) {
    return this.ok(await this.goodsPromoOrderService.createSeckillOrder(
      params.userId,
      params.billNo,
      params.goodsId,
      params.quantity,
      params.remark
    ));
  }

  /**
   * 管理员创建买赠订单（测试用）
   */
  @Post('/createBuyGiftOrder')
  async createBuyGiftOrder(@Body() params: {
    userId: string;
    billNo: string;
    goodsId: string;
    quantity: number;
    remark?: string;
  }) {
    return this.ok(await this.goodsPromoOrderService.createBuyGiftOrder(
      params.userId,
      params.billNo,
      params.goodsId,
      params.quantity,
      params.remark
    ));
  }
} 